package com.itcoon.cloud.framework.security.model;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author Administrator
 * created in 2021/4/28
 */
public class AuthToken implements Serializable {

	/**
	 * 创建时间
	 */
	private LocalDateTime creationTime;

	/**
	 * 更新时间
	 */
	private LocalDateTime updateTime;

	/**
	 * 访问令牌
	 */
	private String accessToken;

	/**
	 * 刷新令牌
	 */
	private String refreshToken;

	/**
	 * 访问令牌过期时间
	 */
	private LocalDateTime accessExpiration;

	/**
	 * 刷新令牌过期时间
	 */
	private LocalDateTime refreshExpiration;

	/**
	 * 锁定状态
	 */
	private Boolean locked = false;

	/**
	 * 用户ID
	 */
	private Long userId;

	public AuthToken() {
	}

	public AuthToken(String accessToken, String refreshToken, LocalDateTime accessExpiration, LocalDateTime refreshExpiration, Long userId) {
		this.accessToken = accessToken;
		this.refreshToken = refreshToken;
		this.accessExpiration = accessExpiration;
		this.refreshExpiration = refreshExpiration;
		this.userId = userId;
		this.creationTime = LocalDateTime.now();
		this.updateTime = LocalDateTime.now();
	}

	public LocalDateTime getCreationTime() {
		return creationTime;
	}

	public void setCreationTime(LocalDateTime creationTime) {
		this.creationTime = creationTime;
	}

	public LocalDateTime getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(LocalDateTime updateTime) {
		this.updateTime = updateTime;
	}

	public String getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}

	public String getRefreshToken() {
		return refreshToken;
	}

	public void setRefreshToken(String refreshToken) {
		this.refreshToken = refreshToken;
	}

	public LocalDateTime getAccessExpiration() {
		return accessExpiration;
	}

	public void setAccessExpiration(LocalDateTime accessExpiration) {
		this.accessExpiration = accessExpiration;
	}

	public LocalDateTime getRefreshExpiration() {
		return refreshExpiration;
	}

	public void setRefreshExpiration(LocalDateTime refreshExpiration) {
		this.refreshExpiration = refreshExpiration;
	}

	public Boolean getLocked() {
		return locked;
	}

	public void setLocked(Boolean locked) {
		this.locked = locked;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}
}
